<!-- 团队增员 -->
<ion-header #ionHeader>
    <ion-toolbar content-page>
        <ion-buttons *ngIf="showBackBtn" start (click)="backToProPage()">
            <button ion-button icon-only>
                <i class="toolbar-back"></i>
            </button>
        </ion-buttons>
        <ion-title>
            <button class="nav-btn" [class.nav-btn_active]="overView!=='1'&&agentLevel !== 'FA'" (click)="toggleView()">个人增员</button>
            <button *ngIf="agentLevel !== 'FA'" class="nav-btn" [class.nav-btn_active]="overView==='1'" (click)="toggleView('1')">团队增员</button>
        </ion-title>
        <ion-buttons end>
            <button ion-button icon-only adpmenutoggle>
                <i class="toolbar-menu"></i>
            </button>
        </ion-buttons>
    </ion-toolbar>
</ion-header>

<ion-content [class.toteam]="overView ==='1'">
    <ion-refresher *ngIf="overView !=='1'" (ionRefresh)="doRefresh($event)" [pullMax]="800">
        <ion-refresher-content></ion-refresher-content>
    </ion-refresher>

    <!-- 团队增员 -->
    <div *ngIf="overView==='1'" class="title_wrapper">
        <div class="search-bar group_bar">
            <div class="title">时间范围</div>
            <ion-datetime [(ngModel)]="teamIncreaseDate.starttime" cancelText="取消" doneText="确定"
                          yearValues="{{yearList}}" displayFormat="YYYY/MM" pickerFormat="YYYYMM" [pickerOptions]="pickerOptions"
                          (ionChange)="dataValidate()" [class.datetime_error]="teamTimeError">
            </ion-datetime>
            <div class="division"></div>
            <ion-datetime [(ngModel)]="teamIncreaseDate.endtime" yearValues="{{yearList}}" cancelText="取消"
                          doneText="确定" displayFormat="YYYY/MM" pickerFormat="YYYYMM" [pickerOptions]="pickerOptions"
                          (ionChange)="dataValidate()" [class.datetime_error]="teamTimeError">
            </ion-datetime>
            <button class="search" myBtn (click)="dateSearch('getTotalMember')" [disabled]="teamTimeError">查询</button>
        </div>
        <div class="group_sel">
            <span (click)="showBusinessGroup($event)"><i></i>{{pageParams.condition?.name?pageParams.condition?.name:'所有组'}}</span>
        </div>
        <div class="group_title">
            <ul>
                <li>营销员</li>
                <li>人才库</li>
                <li>候选人</li>
                <li>虚拟<br>工号</li>
                <li>ITC<br>结训</li>
                <li>入司</li>
            </ul>
        </div>
    </div>
    <div *ngIf="overView==='1'">
        <endless-list #endlessList [containerStyle]="listStyle" [dataSources]="currentScreenData"
                      (scrollToBottom)="scrollToBottom()" [isLoaded]="isLoaded"
                      (scroll)="scrolling($event)">
            <ng-template let-item>
                <div class="team_detail_list">
                    <ul>
                        <li>
                            <ul>
                                <li>{{item?.agentName?item?.agentName:'-'}}</li>
                                <li>{{item?.poolNum?item?.poolNum:'-'}}</li>
                                <li>{{item?.candidateNum?item?.candidateNum:'-'}}</li>
                                <li>{{item?.virtualNum?item.virtualNum:'-'}}</li>
                                <li>{{item?.itcnum?item?.itcnum:'-'}}</li>
                                <li>{{item?.entryNum?item?.entryNum:'-'}}</li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </ng-template>
        </endless-list>
    </div>
    <!-- 个人增员 -->
    <div *ngIf="overView!=='1'" class="add_staff_wrapper">
        <div class="talent-total">

            <div class="total">
                <div class="number">{{totalTalentNumber?totalTalentNumber:0}}</div>
                <div class="talent-title">
                    人才库总人数
                </div>
            </div>

            <button (click)="goDetail()">
                查看详情
            </button>

        </div>
        <div class="content-rel">
            <div class="talent-title">
                增员统计
            </div>

            <div class="search-bar row">
                <div class="title">时间范围</div>

                <ion-datetime cancelText="取消" doneText="确定" displayFormat="YYYY/MM" pickerFormat="YYYYMM" yearValues="{{yearList}}"
                                [class.datetime_error]="personTimeError" (ionChange)="dataValidate()"
                                [pickerOptions]="pickerOptions" [(ngModel)]="personIncreaseDate.starttime">
                </ion-datetime>
                <div class="division"></div>
                <ion-datetime cancelText="取消" doneText="确定" displayFormat="YYYY/MM" pickerFormat="YYYYMM" yearValues="{{yearList}}"
                                [class.datetime_error]="personTimeError"  (ionChange)="dataValidate()"
                                [pickerOptions]="pickerOptions" [(ngModel)]="personIncreaseDate.endtime">
                </ion-datetime>

                <button class="search" myBtn (click)="dateSearch('getPersonIncrease')" [disabled]="personTimeError">查询
                </button>
            </div>

            <div class="condition_total">
                <p>统计时间范围内总人数 <span>{{personIncrease.total}}</span></p>
            </div>

            <div class="talent-type" (click)="goDetail(1)">
                <div class="row-content">
                    <div>
                        <img src="./assets/images/myTeam/icon_hxr.png" alt="">
                        候选人
                    </div>

                    <div>
                        <div>{{personIncrease.candidateNum}}</div>
                        <div class="arrow_r"></div>
                    </div>
                </div>
            </div>

            <div class="talent-type" (click)="goDetail(2)">
                <div class="row-content">
                    <div>
                        <img src="./assets/images/myTeam/icon_xngh.png" alt="">
                        虚拟工号
                    </div>
                    <div>
                        <div>{{personIncrease.virtualNum}}</div>
                        <div class="arrow_r"></div>
                    </div>
                </div>
            </div>

            <div class="talent-type" (click)="goDetail(3)">
                <div class="row-content">
                    <div>
                        <img src="./assets/images/myTeam/icon_itc.png" alt="">
                        ITC结训
                    </div>
                    <div>
                        <div>{{personIncrease.itcnum}}</div>
                        <div class="arrow_r"></div>
                    </div>
                </div>
            </div>

            <div class="talent-type" (click)="goDetail(4)">
                <div class="row-content no_border">
                    <div>
                        <img src="./assets/images/myTeam/icon_rs.png" alt="">
                        入司
                    </div>
                    <div>
                        <div>{{personIncrease.entryNum}}</div>
                        <div class="arrow_r"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</ion-content>
<ion-footer *ngIf="overView==='1'">
    <div class="states_panel">
        <ul>
            <li>合计</li>
            <li>{{ groupRecruitTarget?.totalPoolNum?groupRecruitTarget?.totalPoolNum:'-' }}</li>
            <li>{{ groupRecruitTarget?.totalCandidateNum?groupRecruitTarget?.totalCandidateNum:'-' }}</li>
            <li>{{ groupRecruitTarget?.totalVirtualNum?groupRecruitTarget?.totalVirtualNum:'-' }}</li>
            <li>{{ groupRecruitTarget?.totalITCNum?groupRecruitTarget?.totalITCNum:'-' }}</li>
            <li>{{ groupRecruitTarget?.totalEntryNum?groupRecruitTarget?.totalEntryNum:'-' }}</li>
        </ul>
    </div>
</ion-footer>
